package imongo

import (
	"gitee.com/tietang/terrace-go/v2/base"
	log "github.com/sirupsen/logrus"
)

//全局暴露，单例
var mongoIndexInitRegister *base.InitializerRegister = &base.InitializerRegister{}

func Register(ai base.Initializer) {
	mongoIndexInitRegister.Register(ai)
}

func GetInites() []base.Initializer {
	return mongoIndexInitRegister.Initializers
}

type MongoIndexStarter struct {
	base.BaseStarter
}

func (s *MongoIndexStarter) Init(ctx base.StarterContext) {

}
func (s *MongoIndexStarter) Setup(ctx base.StarterContext) {
	log.Info("InitializerRegister：len=", len(GetInites()))
	for _, v := range GetInites() {
		v.Init()
	}
}
